﻿package mortal.game.view.guild.redPack
{
    import Message.Game.*;

    public class RedPackCache extends Object
    {
        public var redPackState:int = 0;
        public var guildRedEnvelopeInfo:SRedEnvelopeInfo;
        public var selfRedEnvelopeInfo:SRedEnvelopeInfo;
        public var activeEnvelopeInfo:SRedEnvelopeInfo;

        public function RedPackCache()
        {
            return;
        }// end function

        public function getRedPackMoney(param1:int = 0) : int
        {
            var _loc_2:int = 0;
            var _loc_3:SRobRedInfo = null;
            if (param1 == 0)
            {
                _loc_2 = 300;
                if (this.guildRedEnvelopeInfo)
                {
                    for each (_loc_3 in this.guildRedEnvelopeInfo.robInfos)
                    {
                        
                        _loc_2 = _loc_2 - _loc_3.money;
                    }
                }
            }
            else if (param1 == 1)
            {
                if (this.selfRedEnvelopeInfo)
                {
                    _loc_2 = this.selfRedEnvelopeInfo.totalMoney;
                    for each (_loc_3 in this.selfRedEnvelopeInfo.robInfos)
                    {
                        
                        _loc_2 = _loc_2 - _loc_3.money;
                    }
                }
            }
            else if (param1 == 2)
            {
                if (this.activeEnvelopeInfo)
                {
                    _loc_2 = this.activeEnvelopeInfo.totalMoney;
                    for each (_loc_3 in this.activeEnvelopeInfo.robInfos)
                    {
                        
                        _loc_2 = _loc_2 - _loc_3.money;
                    }
                }
            }
            return _loc_2;
        }// end function

    }
}
